package com.hmall.item.pojo;


import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Arrays;
import java.util.List;

@Data
@NoArgsConstructor
public class ItemDoc {

    private Long id;
    private String name;
    private String image;
    private Long price;
    private String brand;
    private String category;
    private Integer sold;  // 销量
    private Integer commentCount; // 评论数

    // 是否是广告
    private Boolean isAD;
    private List<String> suggestion;

    public ItemDoc (Item item){
        this.id = item.getId();
        this.name = item.getName();
        this.image = item.getImage();
        this.price = item.getPrice();
        this.brand = item.getBrand();
        this.category = item.getCategory();
        this.sold = item.getSold();
        this.commentCount = item.getCommentCount();
        this.isAD = item.getIsAD();
        this.suggestion = Arrays.asList(this.brand,this.category);
    }
}
